//
//  NSString+DocDir.m
//  01.SQLite基本使用
//
//  Created by wang on 15/5/18.
//  Copyright (c) 2015年 Bitenergy. All rights reserved.
//

#import "NSString+Dir.h"

@implementation NSString (Dir)

- (NSString *)appendDocumentDir
{
    NSString *docDir = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0];

    return [docDir stringByAppendingPathComponent:self];
}

- (NSString *)appendCacheDir
{
    NSString *cacheDir = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES)[0];
    
    return [cacheDir stringByAppendingPathComponent:self];
}

- (NSString *)appendMainBundleDir
{
    return [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:self];
}

- (NSString *)appendBundleDirWithBundleName:(NSString *)bundleName
{
    NSString *bundlePath = [[NSBundle mainBundle].bundlePath stringByAppendingPathComponent:bundleName];
    
    return [bundlePath stringByAppendingPathComponent:self];
}

@end
